/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GeneticAlgorithm;

import java.util.List;

/**
 *
 * @author andre
 */
public class GeneticAlgorithm {
    GeneticAdapter adapter;
    List< Cromosome > InitialP;
    List < Cromosome > FinalP;
    public GeneticAlgorithm() {
    }
    
    public void setGeneticAdapter( GeneticAdapter adap ){
        adapter = adap;
    } 
    
    public void loadCromosomes(){
        InitialP = adapter.getInitialPopulation();
    }
    
    public List< Cromosome > run(){        
        loadCromosomes();
        for( int i = 0 ; i < adapter.getNumeroIteraciones() ; i++ ){
            FinalP = getSucesores( InitialP );
            InitialP.addAll( FinalP );
            FinalP = adapter.algoritmoSeleccion( InitialP );
            InitialP = FinalP;
        }
        return FinalP;
    }

    private List<Cromosome> getSucesores(List<Cromosome> InitialP) {
        //TODO Logica de combinar soluciones
        throw new UnsupportedOperationException("Not yet implemented");
    }
    
}
